package com.yunji.framework_template.books.orm.persistence.mapper;

import com.yunji.framework_template.books.orm.persistence.model.Books;
import com.yunji.framework_template.common.web.Page;
import java.util.List;

public interface BooksMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Books record);

    int insertSelective(Books record);

    Books selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Books record);

    int updateByPrimaryKeyWithBLOBs(Books record);

    int updateByPrimaryKey(Books record);

    List<Books> selectByCondition(Books record);

    List<Books> selectAll();

    List<Books> selectByPage(Page<Books> page);
    /**
     * 根据是否传入了Cover判断是否获取有Cover或没有Cover的电子书
     * @param page
     * @return
     */
    List<Books> selectByCoverByPage(Page<Books> page);

    Integer count(Books record);

    int deleteByCondition(Books record);

    int updateReadTimesByPrimaryKey(Books book);
    
    int updateLikeTimesByPrimaryKey(Books book);
    
    int updateCommentTimesByPrimaryKey(Books book);
    /**
     * 根据Books.cover的属性是否为空，统计Books.cover是否为空的记录
     * @param record
     * @return
     */
    Integer countByCover(Books record);

    Books selectByBookId(Integer bookId);
}